File control block

A File Control Block (FCB) is a file system structure in which the state of an open file is maintained. The FCB originates from CP/M and is also present in most variants of DOS. A full FCB is 36 bytes long; in early versions of CP/M, it was 33 bytes.

The meanings of several of the fields in the FCB differ between CP/M and MS-DOS, and also depending on what operation is being performed. The following fields have consistent meanings:

Offset Byte
size
Contents
00 1 Drive number — 0 for default, 1 for A:, 2 for B:,...
01 8 File name and file type — together these form a 8.3 file name
09 3
0C 20 Implementation dependent — should be initialised to zero before the FCB is opened.
20 1 Record number in the current section of the file — used when performing sequential access.
21 3 Record number to use when performing random access.

Usage

In CP/M and MS-DOS 1 (which did not include support for directories), the FCB was the only method of accessing files. When directories were introduced in MS-DOS 2, FCBs were superseded by file handles.

FCBs were supported in all versions of MS-DOS and Windows until the introduction of the FAT32 filesystem. Windows 95, Windows 98 and Windows Me do not support the use of FCBs on FAT32 drives, except to read the volume label. This caused some old DOS applications, including Wordstar, to fail under these versions of Windows.

The FCB interface does not work properly on Windows NT, 2000, etc. either - WordStar does not function properly on these operating systems. The emulator DOSEMU implements the FCB interface properly, and is one way to run older programs.

External links